﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using billtracker.Models;
using System.ComponentModel.DataAnnotations;
using System.Web.Script.Serialization;

namespace billtracker.Models
{
    public class bill
    {       
        public int billId { get; set; }

       [Required(ErrorMessage = "Bill name is required")] 
        public string name { get; set; }

        [Required(ErrorMessage = "Amount is required")] 
        public decimal amount { get; set; }

        [Required(ErrorMessage = "Frequency is required")] 
        public int frequencyId { get; set; }

        public virtual frequency Frequency { get; set; }
    }
    public class jsonBill
    {
        public jsonBill(bill bill)
        {
            this.amount = bill.amount;
            this.frequencyId = bill.frequencyId;
            this.name = bill.name;
        }
        public string name { get; set; }
        public decimal amount { get; set; }
        public int frequencyId { get; set; }
    }
    public class billDBContext : DbContext
    {
        public DbSet<bill> Bill { get; set; }
        public DbSet<frequency> Frequency { get; set; }
    }
}
